-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add UnitUtil class #66
Conversation
Change-Id: Ic1a434fda3a051c10e37190aaab22e9db466bb23
Change-Id: Ice09c3c01be6e12f74b889d28b9eae93c5fa6a78
Codecov Report
@@ Coverage Diff @@
## master #66 +/- ##
============================================
+ Coverage 84.78% 85.24% +0.45%
- Complexity 767 795 +28
============================================
Files 60 61 +1
Lines 2209 2298 +89
Branches 325 341 +16
============================================
+ Hits 1873 1959 +86
+ Misses 191 190 -1
- Partials 145 149 +4
Continue to review full report at Codecov.
|
(long) (755 * 1.024) * Bytes.PB); | ||
Assert.assertEquals("7.75 EB", value); | ||
|
||
// overflow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overflow
e.getMessage()); | ||
}); | ||
|
||
// invalid unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Change-Id: I67c7b38979b2c0603878d48929247ec0282d10d9
Assert.assertEquals(0L, UnitUtil.bytesFromReadableString("0 KB")); | ||
Assert.assertEquals(Bytes.KB * 1L, | ||
UnitUtil.bytesFromReadableString("1 KB")); | ||
Assert.assertEquals((long) (Bytes.KB * 3.14), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I detect that this code is problematic. According to the Bad practice (BAD_PRACTICE), CNT: Rough value of known constant found (CNT_ROUGH_CONSTANT_VALUE).
It's recommended to use the predefined library constant for code clarity and better precision.
Change-Id: Ic1a434fda3a051c10e37190aaab22e9db466bb23